#include <bits/stdc++.h>
using namespace std;

int n, base;
vector <int>a;

int main() {
    ios::sync_with_stdio(false);
    cin >> n >> base;
    cout << n << '=';
    while (n) {
        if (n % base >= 0) a.push_back(n % base);
        n /= base;
    }
    a.push_back(2333);
    for (int i = 1; a[i] ^ 2333; i++) {
        cout << a[i];
    }
    cout << "(base" << base << ")\n";
    
}
